package edu.stanford.bmir.protege.web.server.stkosutil.mapper;

import edu.stanford.bmir.protege.web.client.rpc.stkosutil.mapper.MappingOptions;
import edu.stanford.bmir.protege.web.client.rpc.stkosutil.mapper.MappingResult;
import edu.stanford.bmir.protege.web.shared.user.UserId;

public class OntologyMapper {
	public MappingResult mapOntologies(String project1Name, String project2Name, MappingOptions options, UserId userId){
		MappingResult result = new MappingResult();
		ClassMapper classMapper = new ClassMapper();
		result =  classMapper.mapOntologies(project1Name, project2Name, options, userId);
		ObjectPropertyMapper objectPropertyMapper = new ObjectPropertyMapper();
		MappingResult objectPropertyResult = objectPropertyMapper.mapOntologies(project1Name, project2Name, options, userId);
		DataPropertyMapper dataPropertyMapper = new DataPropertyMapper(objectPropertyMapper.getCurrentMappingNo());
		MappingResult dataPropertyResult = dataPropertyMapper.mapOntologies(project1Name, project2Name, options, userId);
		
		result.setO1MappedObjectPropertyNumber(objectPropertyResult.getO1MappedObjectPropertyNumber());
		result.setO1ObjectPropertyNumber(objectPropertyResult.getO1ObjectPropertyNumber());
		result.setO2MappedObjectPropertyNumber(objectPropertyResult.getO2MappedObjectPropertyNumber());
		result.setO2ObjectPropertyNumber(objectPropertyResult.getO2ObjectPropertyNumber());
		
		result.setO1MappedDataPropertyNumber(dataPropertyResult.getO1MappedDataPropertyNumber());
		result.setO1DataPropertyNumber(dataPropertyResult.getO1DataPropertyNumber());
		result.setO2MappedDataPropertyNumber(dataPropertyResult.getO2MappedDataPropertyNumber());
		result.setO2DataPropertyNumber(dataPropertyResult.getO2DataPropertyNumber());
		
		result.setO1PropertyNumber(result.getO1ObjectPropertyNumber() + result.getO1DataPropertyNumber());
		result.setO1MappedPropertyNumber(result.getO1MappedObjectPropertyNumber() + result.getO1MappedDataPropertyNumber());
		
		result.setO2PropertyNumber(result.getO2ObjectPropertyNumber() + result.getO2DataPropertyNumber());
		result.setO2MappedPropertyNumber(result.getO2MappedObjectPropertyNumber() + result.getO2MappedDataPropertyNumber());
		
		return result;
	}
}
